<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>


<s:hidden name="id" value="%{laboratory.id}" theme="simple"/>
<s:hidden name="laboratory.address.id" value="%{laboratory.address.id}"  theme="simple"/>

<table class="tableFilter" style="margin-left: 32%; margin-right: auto;">
    <tbody>
        <tr>
            <td><label>Name:</label></td>
            <td>
                <s:textfield name="laboratory.name" value="%{laboratory.name}"  theme="simple"/>
            </td>
        </tr>


        <tr>
            <td><label>Country:</label></td>
            <td>
                <s:select name="laboratory.address.country"
                              headerKey="" headerValue="Choose a Country"
                              list="countries"
                              listKey="countryId"
                              listValue="country"
                              onchange="getRegions(this,'%{regionsUrl}');">
                </s:select>
            </td>
        </tr>

        <tr>
            <td><label>Region:</label></td>
            <td>
                <select disabled="disabled" name="laboratory.address.province"
                        onchange="getCities(this, '<s:property value="%{citiesUrl}"/>', '<s:property value="%{loaderUrl}"/>');">
                    <option>Select country first</option>
                </select>
            </td>
        </tr>

        <tr>
            <td><label>City:</label></td>
            <td>
                <select disabled="disabled" name="laboratory.address.city" onchange="checkOther(this)">
                    <option value="1">Select country first</option>
                    <option value="2">Select region first</option>
                </select>
                <s:textfield id="otherCity" name="laboratory.address.city" cssStyle="display: none"/>
            </td>
        </tr>


        <tr>
            <td><label>Address:</label></td>
            <td>
                <s:textfield label="Address" name="laboratory.address.address" value="%{laboratory.address.address}"/>
            </td>
        </tr>

    </tbody>

    <tbody>
        <tr>
            <td style="padding-top: 35px"><label style="font-weight: bold;">Normal Values:</label></td>
        </tr>
    </tbody>
    </table>
    <table class="tableFilter" style="margin-right: auto;">
    <tbody id="normalValues">
        <tr>
            <td style="padding-left: 350px"><label>Type:</label></td>
            <td><s:select list="#{'1':'Type 1', '2':'Type 2'}" headerValue="Choose Type"/></td>
        </tr>
        <tr>
            <td style="padding-left: 350px"><label>File:</label></td>
            <td><s:file name="laboratory.normalValues[0]" value="%{laboratory.normalValues[0]}" theme="simple" cssClass="fileClass"/></td>
        </tr>
        <tr>
            <td style="padding-left: 350px"><label>Normal Values Expiration Date:</label></td>
            <td><sd:datetimepicker name="laboratory.normalValues[0]" value="%{laboratory.normalValues[0]}" displayFormat="dd/MM/yyyy"/></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: right"><a class="normalTip" style="text-align: right;" onclick="deleteNormalValue(this.parentNode.parentNode.parentNode)" title="Delete Record"><img style="width: 20px; height: 20px;" src="<s:url value="/images/minus.png"/>" alt="Delete Normal Value"></a></td>
        </tr>
    </tbody>
    <tbody id="add">
        <tr>
            <td colspan="2" style="text-align: right"><a class="normalTip" style="text-align: right;" onclick="addNormalValue()" title="Add Normal Value"><img style="margin-left:10px; width: 20px; height: 20px;" src="<s:url value="/images/plus.png"/>" alt="Add Normal Value"></a></td>
        </tr>
    </tbody>
</table>



<s:hidden label="City" name="laboratory.address.city" id="addressCity" value="%{laboratory.address.city}"  theme="simple"/>
<s:hidden label="Province" name="laboratory.address.province" id="addressProvince" value="%{laboratory.address.province}"  theme="simple"/>
<s:hidden label="Country" name="laboratory.address.country" id="addressCountry" value="%{laboratory.address.country}"  theme="simple"/>

<script type="text/javascript">$('a.normalTip').aToolTip();</script>